package multimedia.model;

import java.awt.Point;
import java.util.Vector;

import multimedia.model.colorspace.ColorspaceInterface;

/**
 * 
 * @author ricky
 *
 */
public class ImageCell {
	private Vector<ColorspaceInterface> pixMap;
	private Point cellCoordinate;
	
	public ImageCell(Vector<ColorspaceInterface> pixMap, Point newPoint)
	{
		this.pixMap = pixMap;
		cellCoordinate = newPoint;
		
	}
	
	public Vector<ColorspaceInterface> getPixMap()
	{
		return pixMap;
	}
	
	public Point getcellCoordinate()
	{
		return cellCoordinate;
	}
	
	public static Vector<ImageCell> divideImage(ModifiedImage pic)
	{
        Vector<ImageCell> coordinatePlane = new Vector<ImageCell>();
        
        int coordinateWidth = pic.getImageSize().width / 8;
        int coordinateHeight = pic.getImageSize().height / 8;
        
        
        
        for (int i = 0; i < coordinateHeight; i++)
        {
        	for (int j = 0; j < coordinateWidth; j++)
        	{
        		Vector<ColorspaceInterface> rgbVector = new Vector<ColorspaceInterface>();
        		for (int k = 0; k < 8; k++)
        		{
        			for (int m = 0; m < 8; m++)
        			{
        				rgbVector.add(pic.getImagePixelHolder().getPixelAt(k, m));
        			}
        		}
        		coordinatePlane.add(new ImageCell(rgbVector, new Point(i,j)));
        	}
        }
        
        return coordinatePlane;
	}

}
